-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ncm-afsclt: fix handling of size AUTOMATIC #816
Conversation
I'll try to add a unit test. This is one weakness of this configuration module: there is basically no unit test. |
That and many sites have stopped using AFS. |
Unit tests added for test configurations. Uncovered a few potential issues, in particular if the initial |
$afs_cacheinfo_fh->cancel(); | ||
if ( "$afs_cacheinfo_fh" =~ m;^([^:]+):([^:]+):(\d+)$; ) { | ||
my $afs_cacheinfo_fh = CAF::FileReader->new( $AFS_CACHEINFO, log => $self ); | ||
$self->debug(2, "$AFS_CACHEINFO current contents: >>>$afs_cacheinfo_fh<<<"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only in else block? (and in that case, maybe in the error message)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In fact, I realized that my mod was wrong because if was no longer possible to override value in cacheinfo
by the Quattor configuration. cacheinfo
should only be used as default values. fixed.
some minor remarks, LGTM otherwise |
@stdweird thanks as usual for the remarks. I'll address them tomorrow. Most of them in fact apply to the original code and its last modification in december. I tried to address an urgent problem but didn't attempt to fix all the possible ones. I'll also try to improve a little bit the unit tests. |
Should be ok now. Remarks addresssed. Unit tests improved. |
@ajf8 you may want to have a look and to check that this doesn't break anything for you, compared to the last modifications you committed in December 2015. |
"afs_mount" ? string # AFS mount point (e.g. /afs) | ||
"cachemount" ? string # AFS cache location (/usr/vice/etc/cache) | ||
"cachesize" ? string # AFS cache size in kB | ||
"enabled" : string with match (SELF, 'yes|no') # Shall AFS client be active ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use legacy_binary_affirmation_string
instead.
@jouvin thanks for the further cleanup. |
- Previously tending to return a status only in case of error...
$self->debug(1, "AFS mount point not defined: using default ($AFS_MOUNTPOINT_DEF)"); | ||
$file_afsmount = $AFS_MOUNTPOINT_DEF; | ||
} | ||
if ( "$new_cache" ne "$file_cache" ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with this check, the AFS_CACHEINIFO
is only updated is file_cache
is modified, nit file_afsmount
or file_cache_mount
i would always write the file, and with the close
returns a change in content, do the block below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch!
- Also fix return status in case of success in Configure_CellServDB (used to be 1 instead of 0)
As for me, ready for merging! @stdweird any other remark?! |
my $thiscell_fh = CAF::FileWriter->new( $THISCELL, log => $self ); | ||
print $thiscell_fh "$afscell\n"; | ||
print $thiscell_fh $config->{thiscell}."\n"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there's no need for the stirng concat, "$config->{thiscell}\n"
should also work, now that $config
is a hashref.
@ajf8 feedback would be great but I really think I introduced no feature changes but just fixed things that were addressing just the MS way of configuring AFS but had some flaws due to the lack of unit testing (the main change introduced by this PR!). |
"afs_mount" ? string # AFS mount point (e.g. /afs) | ||
"cachemount" ? string # AFS cache location (/usr/vice/etc/cache) | ||
"cachesize" ? string # AFS cache size in kB | ||
"enabled" : legacy_binary_affirmation_string # Shall AFS client be active ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO this is a retrograde step for readability. I now need to locate this type defined in some other file before I can understand how to populate this mandatory field, which has no default. legacy_yes_or_no_string would be more intuitive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tend to agree... I was thinking the same thing when doing the modification suggested by @stdweird ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feel free to open an issue to change. This is work done in quattor/template-library-core#111 and #749; but renaming the type should be very trivial.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO it would be better to make the effort to change the type to boolean instead of renaming the legacy type.
Thanks for the improvements @jouvin and sorry about the break. I think this module needed some work, hopefully I got some of it done, but it looks much better now especially with the unit tests. Please feel free to merge, I will test it sometime and submit a new pull request if anything is needed. |
@ajf8 thanks for the feedback |
Fixes #815.